package findElement;

import org.junit.Test;

public class SequentialSearch {
	/**
	 * 没有排序的数组只能进行顺序查找
	 */
	@Test
	public void fun() {
		int[] list = {1, 3, 4};
		System.out.println(sequentialSearch(list, 3));
	}
	public int sequentialSearch(int[] list, int ele) {
		for(int i = 0; i < list.length; i ++) {
			if(ele == list[i]) return i;
		}
		return -1;
	}
}
